# Title: Right-wing terror, media backlash, and voting preferences for the far right
# Authors: Alexander De Juan, Felix Haass, Julian Voss
# Date: 01.05.2025
# Load libraries ----------------------------------------------------------
library(tidyverse)
library(ggrepel)
library(patchwork)
library(fixest)
library(broom)
library(haven)
library(ggtext)
library(fastDummies)
library(marginaleffects)
library(modelsummary)
library(tinytable)
library(sjlabelled)
library(scales)
# Load data ---------------------------------------------------------------
# WVS data on media sources
wvs_cpds_data <- read_rds("./data/wvs_cpds_data.rds")
# RTV & aggregated voting data
rtv_timeline_ag <- read_rds("./data/rtv_timeline_ag.rds")
voting_timeline_data <- read_rds("./data/voting_timeline_data.rds")
# main Forsabus data
fb_2019_2020_models <- read_rds("./data/forsa_data_hanau.rds")
# survey data
bilendi_survey <- read_rds("./data/bilendi_survey.rds")
# Google trend data
terror_gtrend <- read_rds("./data/anschlag_hanau.rds")
hanau_gtrend <- read_rds("./data/hanau.rds")
# Tweets for Covid-19 analysis
tweets <- read_rds("./data/tweets_hanau_halle_wolfhagen_reshaped_11_10_2023.rds")
# Data on attitudes towards refugees for alt. explanation tests
refugee_survey <- read_rds("./data/refugee_survey.rds")
# Newspaper articles
hanau_articles_coded <- read_rds("./data/hanau_articles_coded.rds")
hanau_articles_pol_leaning <- read_rds("./data/hanau_articles_pol_leaning.rds")
hanau_articles <- read_rds("./data/hanau_articles.rds")
# Define covariates -------------------------------------------------------
## NOTE! Several analyses below require these covariate vectors to be set,
## so please make sure these are defined when you rund individual analyses,
## otherwise there will be an error message!
# define covariates for Forsabus
covariates <- c(
"male",
"bland",
"birth_decade",
"income",
"education",
"occupation_status",
"sample",
"religion",
"children",
"family_status"
)
# define PAP covariates for survey experiment
cov_full_pap  <- c("male",
"age",
"factor(education)",
"political_interest",
"party_preference_pre_1",
"party_preference_pre_2",
"party_preference_pre_3",
"party_preference_pre_4",
"party_preference_pre_5",
"party_preference_pre_6"
)
coefs <- list()
counter <- 1
for(window in -10:10) {
temp_data <- fb_2019_2020_models %>%
mutate(days_new = date - as.Date("2019-02-24"))  %>%
mutate(days_new = days_new + window) %>%
filter(days_new %in% c(-5:4)) %>%
mutate(post_hanau = ifelse(days_new >= 0, 1, 0))
coef_temp <- feols(ltw_afd_intention ~
post_hanau
| .[covariates],
se = "hetero",
data = temp_data) %>%
tidy(., conf.int = T) %>%
mutate(window = window)
coefs[[counter]] <- coef_temp
counter <- counter + 1
}
placebo_fals_data <- coefs %>% map_dfr(., as_tibble) %>%
filter(!grepl("Intercept", term)) %>%
mutate(year = "2019")
falsification_dates_plot <- placebo_fals_data %>%
ggplot(., aes(x = window, y = estimate)) +
geom_hline(yintercept = 0, linetype = "dashed") +
geom_errorbar(aes(ymin = conf.low, ymax = conf.high),
width = 0, linewidth = 0.25,
position = position_dodge(width = 0.75)) +
geom_errorbar(aes(ymin = estimate - 1.645 * std.error,
ymax = estimate + 1.645 * std.error),
width = 0, linewidth = 0.7,
position = position_dodge(width = 0.75)) +
geom_point(size = 2.5, aes(x = window, y = estimate),
position = position_dodge(width = 0.75)) +
geom_line(aes(x = window, y = estimate, group = year),
position = position_dodge(width = 0.75)) +
theme_bw() +
theme(panel.grid = element_blank(),
legend.position = "none") +
scale_color_manual(values = c("grey50", "black")) +
scale_linetype_manual(values = c("dotted", "solid")) +
labs(x= "Shifting cutoff by ... days", y = "Coefficient estimate") +
facet_wrap(year ~., labeller = labeller(year = c("2019" = "Placebo date: 20 February 2019",
"2020" = "Actual date of the attack: February 2020")))
falsification_dates_plot
forsa_comp <- fb_2019_2020_models %>%
filter(days_new %in% c(-5:4)) %>%
mutate(education = demo9) %>%
mutate(education = case_when(education == 1 ~ "No high school",
education == 2 ~ "Hauptschule",
education %in% 3:4 ~ "Realschule",
education %in% 5:7 ~ "Abitur/\nFachhochschulreife",
TRUE ~ NA)
) %>%
mutate(gebj = 2020 - gebj) %>%
mutate(age_cat = case_when(gebj %in% 18:25 ~ "18-25",
gebj %in% 26:35 ~ "26-25",
gebj %in% 36:45 ~ "36-45",
gebj %in% 46:55 ~ "46-55",
gebj %in% 56:65 ~ "56-65",
gebj > 65 ~ "66+",
TRUE ~ NA
))
# Load libraries ----------------------------------------------------------
library(tidyverse)
library(ggrepel)
library(patchwork)
library(fixest)
library(broom)
library(haven)
library(ggtext)
library(fastDummies)
library(marginaleffects)
library(modelsummary)
library(tinytable)
library(sjlabelled)
library(scales)
# Load data ---------------------------------------------------------------
# WVS data on media sources
wvs_cpds_data <- read_rds("./data/wvs_cpds_data.rds")
# RTV & aggregated voting data
rtv_timeline_ag <- read_rds("./data/rtv_timeline_ag.rds")
voting_timeline_data <- read_rds("./data/voting_timeline_data.rds")
# main Forsabus data
fb_2019_2020_models <- read_rds("./data/forsa_data_hanau.rds")
# survey data
bilendi_survey <- read_rds("./data/bilendi_survey.rds")
# Google trend data
terror_gtrend <- read_rds("./data/anschlag_hanau.rds")
hanau_gtrend <- read_rds("./data/hanau.rds")
# Tweets for Covid-19 analysis
tweets <- read_rds("./data/tweets_hanau_halle_wolfhagen_reshaped_11_10_2023.rds")
# Data on attitudes towards refugees for alt. explanation tests
refugee_survey <- read_rds("./data/refugee_survey.rds")
# Newspaper articles
hanau_articles_coded <- read_rds("./data/hanau_articles_coded.rds")
hanau_articles_pol_leaning <- read_rds("./data/hanau_articles_pol_leaning.rds")
hanau_articles <- read_rds("./data/hanau_articles.rds")
# Define covariates -------------------------------------------------------
## NOTE! Several analyses below require these covariate vectors to be set,
## so please make sure these are defined when you rund individual analyses,
## otherwise there will be an error message!
# define covariates for Forsabus
covariates <- c(
"male",
"bland",
"birth_decade",
"income",
"education",
"occupation_status",
"sample",
"religion",
"children",
"family_status"
)
# define PAP covariates for survey experiment
cov_full_pap  <- c("male",
"age",
"factor(education)",
"political_interest",
"party_preference_pre_1",
"party_preference_pre_2",
"party_preference_pre_3",
"party_preference_pre_4",
"party_preference_pre_5",
"party_preference_pre_6"
)
forsa_comp <- fb_2019_2020_models %>%
filter(days_new %in% c(-5:4)) %>%
mutate(education = demo9) %>%
mutate(education = case_when(education == 1 ~ "No high school",
education == 2 ~ "Hauptschule",
education %in% 3:4 ~ "Realschule",
education %in% 5:7 ~ "Abitur/\nFachhochschulreife",
TRUE ~ NA)
) %>%
mutate(gebj = 2020 - gebj) %>%
mutate(age_cat = case_when(gebj %in% 18:25 ~ "18-25",
gebj %in% 26:35 ~ "26-25",
gebj %in% 36:45 ~ "36-45",
gebj %in% 46:55 ~ "46-55",
gebj %in% 56:65 ~ "56-65",
gebj > 65 ~ "66+",
TRUE ~ NA
))
# Load libraries ----------------------------------------------------------
library(tidyverse)
library(ggrepel)
library(patchwork)
library(fixest)
library(broom)
library(haven)
library(ggtext)
library(fastDummies)
library(marginaleffects)
library(modelsummary)
library(tinytable)
library(sjlabelled)
library(scales)
# Load data ---------------------------------------------------------------
# WVS data on media sources
wvs_cpds_data <- read_rds("./data/wvs_cpds_data.rds")
# RTV & aggregated voting data
rtv_timeline_ag <- read_rds("./data/rtv_timeline_ag.rds")
voting_timeline_data <- read_rds("./data/voting_timeline_data.rds")
# main Forsabus data
fb_2019_2020_models <- read_rds("./data/forsa_data_hanau.rds")
# survey data
bilendi_survey <- read_rds("./data/bilendi_survey.rds")
# Google trend data
terror_gtrend <- read_rds("./data/anschlag_hanau.rds")
hanau_gtrend <- read_rds("./data/hanau.rds")
# Tweets for Covid-19 analysis
tweets <- read_rds("./data/tweets_hanau_halle_wolfhagen_reshaped_11_10_2023.rds")
# Data on attitudes towards refugees for alt. explanation tests
refugee_survey <- read_rds("./data/refugee_survey.rds")
# Newspaper articles
hanau_articles_coded <- read_rds("./data/hanau_articles_coded.rds")
hanau_articles_pol_leaning <- read_rds("./data/hanau_articles_pol_leaning.rds")
hanau_articles <- read_rds("./data/hanau_articles.rds")
# Define covariates -------------------------------------------------------
## NOTE! Several analyses below require these covariate vectors to be set,
## so please make sure these are defined when you rund individual analyses,
## otherwise there will be an error message!
# define covariates for Forsabus
covariates <- c(
"male",
"bland",
"birth_decade",
"income",
"education",
"occupation_status",
"sample",
"religion",
"children",
"family_status"
)
# define PAP covariates for survey experiment
cov_full_pap  <- c("male",
"age",
"factor(education)",
"political_interest",
"party_preference_pre_1",
"party_preference_pre_2",
"party_preference_pre_3",
"party_preference_pre_4",
"party_preference_pre_5",
"party_preference_pre_6"
)
forsa_comp <- fb_2019_2020_models %>%
filter(days_new %in% c(-5:4)) %>%
mutate(education = demo9) %>%
mutate(education = case_when(education == 1 ~ "No high school",
education == 2 ~ "Hauptschule",
education %in% 3:4 ~ "Realschule",
education %in% 5:7 ~ "Abitur/\nFachhochschulreife",
TRUE ~ NA)
) %>%
mutate(gebj = 2020 - gebj) %>%
mutate(age_cat = case_when(gebj %in% 18:25 ~ "18-25",
gebj %in% 26:35 ~ "26-25",
gebj %in% 36:45 ~ "36-45",
gebj %in% 46:55 ~ "46-55",
gebj %in% 56:65 ~ "56-65",
gebj > 65 ~ "66+",
TRUE ~ NA
))
fb_2019_2020_models$F
# File description -------------------------------------------------------------
# Replication file: Appendix
# Title: Right-wing terror, media backlash, and voting preferences for the far right
# Authors: Alexander De Juan, Felix Haass, Julian Voss
# Date: 01.05.2025
# Load libraries ----------------------------------------------------------
library(tidyverse)
library(ggrepel)
library(patchwork)
library(fixest)
library(broom)
library(haven)
library(ggtext)
library(fastDummies)
library(marginaleffects)
library(modelsummary)
library(tinytable)
library(sjlabelled)
library(scales)
# Load data ---------------------------------------------------------------
# WVS data on media sources
wvs_cpds_data <- read_rds("./data/wvs_cpds_data.rds")
# RTV & aggregated voting data
rtv_timeline_ag <- read_rds("./data/rtv_timeline_ag.rds")
voting_timeline_data <- read_rds("./data/voting_timeline_data.rds")
# main Forsabus data
fb_2019_2020_models <- read_rds("./data/forsa_data_hanau.rds")
# survey data
bilendi_survey <- read_rds("./data/bilendi_survey.rds")
# Google trend data
terror_gtrend <- read_rds("./data/anschlag_hanau.rds")
hanau_gtrend <- read_rds("./data/hanau.rds")
# Tweets for Covid-19 analysis
tweets <- read_rds("./data/tweets_hanau_halle_wolfhagen_reshaped_11_10_2023.rds")
# Data on attitudes towards refugees for alt. explanation tests
refugee_survey <- read_rds("./data/refugee_survey.rds")
# Newspaper articles
hanau_articles_coded <- read_rds("./data/hanau_articles_coded.rds")
hanau_articles_pol_leaning <- read_rds("./data/hanau_articles_pol_leaning.rds")
hanau_articles <- read_rds("./data/hanau_articles.rds")
# Define covariates -------------------------------------------------------
## NOTE! Several analyses below require these covariate vectors to be set,
## so please make sure these are defined when you rund individual analyses,
## otherwise there will be an error message!
# define covariates for Forsabus
covariates <- c(
"male",
"bland",
"birth_decade",
"income",
"education",
"occupation_status",
"sample",
"religion",
"children",
"family_status"
)
# define PAP covariates for survey experiment
cov_full_pap  <- c("male",
"age",
"factor(education)",
"political_interest",
"party_preference_pre_1",
"party_preference_pre_2",
"party_preference_pre_3",
"party_preference_pre_4",
"party_preference_pre_5",
"party_preference_pre_6"
)
te_mod_attention_0 <- feols(afd_pref_post ~
factor(treatment) +
.[cov_full_pap],
data = bilendi_survey,
se = "standard")
forsa_comp <- fb_2019_2020_models %>%
filter(days_new %in% c(-5:4)) %>%
mutate(education = demo9) %>%
mutate(education = case_when(education == 1 ~ "No high school",
education == 2 ~ "Hauptschule",
education %in% 3:4 ~ "Realschule",
education %in% 5:7 ~ "Abitur/\nFachhochschulreife",
TRUE ~ NA)
) %>%
mutate(gebj = 2020 - gebj) %>%
mutate(age_cat = case_when(gebj %in% 18:25 ~ "18-25",
gebj %in% 26:35 ~ "26-25",
gebj %in% 36:45 ~ "36-45",
gebj %in% 46:55 ~ "46-55",
gebj %in% 56:65 ~ "56-65",
gebj > 65 ~ "66+",
TRUE ~ NA
))
covariates_fb <- c(
"male",
"bland",
"age_cat",
"education"
)
forsa_comp <- forsa_comp %>%
mutate(across(all_of(covariates_fb), \(x) sjlabelled::as_label(x))) %>%
select(all_of(covariates_fb, weight2))
balance <- function(x, df = NULL) {
temp_df <- df %>%
group_by(across(all_of(x)))  %>%
summarise(n = n()) %>%
ungroup() %>%
mutate(n_sum = sum(n)) %>%
mutate(covariate = x)
names(temp_df)[1] <- "cov_value"
temp_df <- temp_df %>%
mutate(share = n / n_sum) %>%
group_by(cov_value) %>%
mutate(upper_ci = share + 1.96 * sqrt(share * (1- share) / n_sum),
lower_ci = share - 1.96 * sqrt(share * (1- share) / n_sum)) %>%
select(-c(n, n_sum))
temp_df
}
forsa_comp <- fb_2019_2020_models %>%
filter(days_new %in% c(-5:4)) %>%
mutate(education = demo9) %>%
mutate(education = case_when(education == 1 ~ "No high school",
education == 2 ~ "Hauptschule",
education %in% 3:4 ~ "Realschule",
education %in% 5:7 ~ "Abitur/\nFachhochschulreife",
TRUE ~ NA)
) %>%
mutate(gebj = 2020 - gebj) %>%
mutate(age_cat = case_when(gebj %in% 18:25 ~ "18-25",
gebj %in% 26:35 ~ "26-25",
gebj %in% 36:45 ~ "36-45",
gebj %in% 46:55 ~ "46-55",
gebj %in% 56:65 ~ "56-65",
gebj > 65 ~ "66+",
TRUE ~ NA
))
covariates_fb <- c(
"male",
"bland",
"age_cat",
"education"
)
forsa_comp <- forsa_comp %>%
mutate(across(all_of(covariates_fb), \(x) sjlabelled::as_label(x))) %>%
select(all_of(covariates_fb, weight2))
forsa_comp <- forsa_comp %>%
mutate(across(all_of(covariates_fb), \(x) sjlabelled::as_label(x))) %>%
select(all_of(covariates_fb))
balance <- function(x, df = NULL) {
temp_df <- df %>%
group_by(across(all_of(x)))  %>%
summarise(n = n()) %>%
ungroup() %>%
mutate(n_sum = sum(n)) %>%
mutate(covariate = x)
names(temp_df)[1] <- "cov_value"
temp_df <- temp_df %>%
mutate(share = n / n_sum) %>%
group_by(cov_value) %>%
mutate(upper_ci = share + 1.96 * sqrt(share * (1- share) / n_sum),
lower_ci = share - 1.96 * sqrt(share * (1- share) / n_sum)) %>%
select(-c(n, n_sum))
temp_df
}
fb_comp_profile <- map_dfr(covariates_fb, \(x) balance(x, forsa_comp)) %>%
filter(!is.na(cov_value)) %>%
mutate(data = "Hanau analysis (Forsa-Bus)")
bilendi_comp <- bilendi_survey %>%
mutate(education = case_when(education == 1 ~ "No high school",
education == 2 ~ "Hauptschule",
education %in% 3:4 ~ "Realschule",
education %in% 5:6 ~ "Abitur/\nFachhochschulreife",
TRUE ~ NA)
) %>%
mutate(age_cat = case_when(age %in% 18:25 ~ "18-25",
age %in% 26:35 ~ "26-25",
age %in% 36:45 ~ "36-45",
age %in% 46:55 ~ "46-55",
age %in% 56:65 ~ "56-65",
age > 65 ~ "66+",
TRUE ~ NA
)) %>%
rename(bland = state) %>%
mutate(male = ifelse(male == 1, "male", "female"))
covariates_bilendi <- c("male", "bland", "age_cat", "education")
bilendi_comp <- bilendi_comp %>%
mutate(across(all_of(covariates_bilendi), \(x) sjlabelled::as_label(x))) %>%
select(all_of(covariates_bilendi))
bilendi_comp_profile <-  map_dfr(covariates_bilendi, \(x) balance(x, df = bilendi_comp)) %>%
filter(!is.na(cov_value)) %>%
mutate(data = "Survey experiment (Bilendi)")
forsa_bilendi_comp_plot <- bind_rows(bilendi_comp_profile,
fb_comp_profile) %>%
mutate(cov_value = ifelse(grepl("Westf", cov_value), "Nordrhein-Westfalen", cov_value)) %>%
mutate(cov_value = ifelse(grepl("Württ", cov_value), "Baden-Württemberg", cov_value)) %>%
mutate(cov_value = ifelse(covariate == "bland", gsub("\\-", "\\-\n", cov_value), cov_value)) %>%
ggplot(., aes(x = cov_value,
y = share,
group = data,
fill = data)) +
geom_col(position = position_dodge2(width = 1, preserve = "single"),
color = "black", linewidth = 0.25) +
geom_linerange(aes(ymin = lower_ci, ymax = upper_ci),
position = position_dodge2(width = .9, preserve = "single")) +
geom_point(shape = 21,
position = position_dodge2(width = .9, preserve = "single")) +
facet_wrap(~covariate, scales = "free", nrow = 2,
labeller = labeller(covariate = c("age_cat" = "Age",
"bland" = "State",
"education" = "Education",
"male" = "Gender"))) +
scale_fill_manual("Data source: ", values = c("grey", "white")) +
theme_bw() +
theme(panel.grid = element_blank()) +
theme(axis.text.y = element_text(size = 8),
legend.position = "bottom") +
labs(x = "", y = "Share") +
coord_flip()
forsa_bilendi_comp_plot
